/**
 * Generali Solutions d'assurances - Tous droits rÃ©servÃ©s &copy; 2007 - 2010
 */

package fr.generali.accueilclient.opt.detaildossier.builder;

import java.math.BigDecimal;

import fr.generali.accueilclient.opt.detaildossier.om.IMonetaryQuantity;
import fr.generali.accueilclient.opt.detaildossier.om.impl.DTOMonetaryQuantity;

/**
 * @author Holmes Kelly
 */
public class DTOMonetaryQuantityBuilder extends DTOMonetaryQuantityBuilderBase<DTOMonetaryQuantityBuilder> {

    /**
     * constructeur
     */
    public DTOMonetaryQuantityBuilder() {
        super(new DTOMonetaryQuantity());
    }

    /**
     * @return DTOMonetaryQuantityBuilder
     */
    public static DTOMonetaryQuantityBuilder dTOMonetaryQuantity() {
        return new DTOMonetaryQuantityBuilder();
    }

    /**
     * @return DTOMonetaryQuantity
     */
    public IMonetaryQuantity build() {
        return getInstance();
    }
}

/**
 * @author Holmes Kelly
 * @param <GeneratorT>
 */
class DTOMonetaryQuantityBuilderBase<GeneratorT extends DTOMonetaryQuantityBuilderBase<GeneratorT>> {

    /**
     * instance
     */
    private IMonetaryQuantity instance;

    /**
     * @param aInstance instance
     */
    protected DTOMonetaryQuantityBuilderBase(IMonetaryQuantity aInstance) {
        instance = aInstance;
    }

    /**
     * @return instance
     */
    protected IMonetaryQuantity getInstance() {
        return instance;
    }

    /**
     * @param aValue unit
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildUnit(String aValue) {
        instance.setUnit(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue value
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildValue(BigDecimal aValue) {
        instance.setValue(aValue);

        return (GeneratorT ) this;
    }
}
